package io.elegant.sessions.widgets

import android.content.Context
import androidx.appcompat.widget.AppCompatEditText
import io.elegant.Elegant
import io.elegant.ElegantApiGrpc
import io.elegant.widgets.EditorWidget
import io.grpc.stub.StreamObserver
import kotlin.reflect.KClass

class WidgetEditorSession(
    stub: ElegantApiGrpc.ElegantApiStub,
    context: Context
): BaseWidgetSession<AppCompatEditText, EditorWidget<AppCompatEditText>>(stub, context) {
    override val clazz = AppCompatEditText::class
    @Suppress("UNCHECKED_CAST")
    override val widgetClazz = EditorWidget::class as KClass<EditorWidget<AppCompatEditText>>
    override val sendStreamObserver: StreamObserver<Elegant.Interaction> = stub.widgetEditor(receiveStreamObserver)

}